/*
 * @Description: Queue.h
 * @author <秋落风声>
 * @addindex 2024-06-27
 * @Email <907741673@qq.com>
 * @attention： sharing content under the CC BY-NC-SA 4.0 license, please indicate the source.
 * @call: 如果你只是想看中文的，请尽情访问我的网站，右边附上对应博客链接：https://github.com/yue-plus/data-structure
 */


#include<stdbool.h>
#include<assert.h>
#include<stdio.h>
#include<stdlib.h>
#include "HuffmanTree.h"
// 定义优先队列的元素类型（可以根据需要调整）
// Define the type of elements in the priority queue (can be adjusted according to needs)
typedef HuffmanTreeNode* PriorityQueueDataType;

// Type definition for the priority queue 优先队列类型定义
typedef struct PriorityQueuestruct
{
    PriorityQueueDataType *elements;
    int size;
    int capacity;
} PriorityQueue;

// @brief Create a new priority queue 创建新的优先队列
PriorityQueue *PQ_Create(int capacity);

// @brief Destroy the priority queue and free its allocated memory 销毁优先队列并释放其占用的内存
void PQ_Destroy(PriorityQueue *pq);

// @brief Insert an element into the priority queue  优先队列插入元素
void PQ_Insert(PriorityQueue *pq, PriorityQueueDataType x);

// @brief Remove and return the element with the highest priority from the priority queue  优先队列中删除并返回具有最高优先级的元素
PriorityQueueDataType PQ_Extract(PriorityQueue *pq);

// @brief Check if the priority queue is empty 检查优先队列是否为空
bool PQ_IsEmpty(PriorityQueue *pq);

// @brief Get the size of the priority queue 获取优先队列的大小
int PQ_Size(PriorityQueue *pq);

// @brief Get the capacity of the priority queue 获取优先队列的容量
int PQ_Capacity(PriorityQueue *pq);

// @brief Check if the priority queue is full 检查优先队列是否已满
bool PQ_IsFull(PriorityQueue *pq);

void MinHeap(PriorityQueueDataType *elements, int size);
